// components/custom-navigator/customNavgator.js
const app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    customBack: {
      type: String,
      value: ''
    },
    hasBack: {
      type: Boolean,
      value: true
    },
    bgColor: {
      type: String,
      value: '#fff'
    }
  },

  options: {
    addGlobalClass: true,
  },
  /**
   * 组件的初始数据
   */
  data: {
    navBarHeight: app.globalData.navBarHeight,
    statusBarHeight: app.globalData.statusBarHeight,
  },

  ready () {
    console.log(app.globalData.navBarHeight)
    this.setData({
      navBarHeight: app.globalData.navBarHeight,
      statusBarHeight: app.globalData.statusBarHeight,
    })
  },

  /**
   * 组件的方法列表
   */
  methods: {
    reBack () {
      if (this.data.customBack === 'custom') {
        this.triggerEvent('customback', {}, {})
      } else {
        wx.navigateBack()
      }
    }
  }
})
